package com.lucky.contract.util;

import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Properties;

public class Config {
    private static Properties pps = new Properties();

    public static String ReadPropertie(String key) {
        initConfig();
        return pps.getProperty(key);
    }

    private static void initConfig() {
        try{
            if (pps.isEmpty()) {
                String path = Thread.currentThread().getContextClassLoader().getResource("").toURI().getPath();
                InputStream in = new BufferedInputStream(new FileInputStream(path + "app.properties"));
                pps.load(new InputStreamReader(in, "utf-8"));
            }
        }catch (Exception e){
            e.printStackTrace();
        }
    }
}
